package com.ly.work.practice;

//偶数线程
public class EvenThread extends Thread {


    @Override
    public void run() {

        synchronized (Main01.class) {
            while (Main01.i<=100){
                if (Main01.i%2==0){
                    System.out.println(Thread.currentThread().getName()+"==偶数=="+Main01.i);
                    Main01.i++;
                    try {
                        Main01.class.notify();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }else {
                    try {
                        Main01.class.wait();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }
        }
    }
}
